

import  unittest
import os
import yaml
data = yaml.safe_load(open('./config.yaml',encoding='utf8'))
print(data)
# 与Jenkins中配置的矩阵名称保持一致；
task = os.getenv('alltask')
print(task)
testscases = data.get(task)
def create_suite():
    suite = unittest.TestSuite()
    loader = unittest.TestLoader()
    # 执行用例
    print(testscases)
    tests = loader.loadTestsFromNames(testscases)
    suite.addTests(tests)
    return suite

if __name__ == '__main__':
    runner = unittest.TextTestRunner(verbosity=2)
    runner.run(create_suite())




